﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PrimaryAlgorithm.ReverseBits
{
    class MainProject
    {
        static void Main(string[] args)
        {
            ////char[] s = new char[] { 'h', 'e', 'l', 'l', 'o' };
            int s = -1236546139;
            Console.WriteLine(ReverseBits(964176192));
            Console.WriteLine();
            Console.ReadKey();
        }
        public static uint ReverseBits(uint n)
        {
            //2147483648
            uint m = 0;
            for (int i = 0; i < 32; i++)
            {
                if ((1 & n) == 0)
                {
                    n >>= 1;
                    m <<= 1;
                    m |= 0;
                }
                else
                {
                    n >>= 1;
                    m <<= 1;
                    m |= 1;
                }
            }
            return m;
        }
    }
}
